package net.exoweb.animate.common
{
    import net.exoweb.animate.objects.Vector;

    public class Maths
    {
        public static const PI:Number = 3.141592653589793;
        public static const EXP:Number = 1e-6;
        public static const MAX_ANGLE:Number = 360;

        public static function getRadian(angle:Number):Number
        {
            return (PI * angle) / 180;
        }

        public static function rotate(v:Vector, angle:Number):Vector
        {
            var res:Vector = new Vector(0, 0);
            var radian:Number = getRadian(angle);
            var s:Number = Math.sin(radian);
            var c:Number = Math.cos(radian);
            res.x = v.x * c - v.y * s;
            res.y = v.y * c + v.x * s;
            return res;
        }
    }
}
